home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / guides-new.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  1.2 KB  |  38 lines

  1. ;; -*-scheme-*-
  2.  
  3. ;; Alan Horkan 2004.  Public Domain.  
  4. ;; so long as remove this block of comments from your script
  5. ;; feel free to use it for whatever you like.  
  6.  
  7. (define (script-fu-guide-new image
  8.                  drawable
  9.                  direction
  10.                  position)
  11.   (let* ((width (car (gimp-drawable-width drawable)))
  12.      (height (car (gimp-drawable-height drawable))))
  13.     (gimp-image-undo-group-start image)
  14.  
  15.     (if (= direction 0) 
  16.     ;; check position is inside the image boundaries
  17.     (if (< position height) (gimp-image-add-hguide image position))
  18.     (if (< position width) (gimp-image-add-vguide image position)))
  19.  
  20.     (gimp-image-undo-group-end image)
  21.     (gimp-displays-flush)))
  22.     
  23. (script-fu-register "script-fu-guide-new" 
  24.             _"New _Guide..." 
  25.             "Add a single Line Guide with the specified postion and orientation. Postion is specified in Pixels (px)."
  26.             "Alan Horkan"
  27.             "Alan Horkan, 2004.  Public Domain."
  28.             "2004-04-02"
  29.             ""
  30.             SF-IMAGE      "Image"      0 
  31.             SF-DRAWABLE   "Drawable"   0
  32.             SF-OPTION     _"Direction" '(_"Horizontal" 
  33.                          _"Vertical")
  34.             SF-ADJUSTMENT "Position"   '(0 0 262144 1 10 0 1))
  35.     
  36. (script-fu-menu-register "script-fu-guide-new" 
  37.              "<Image>/Image/Guides")
  38.